package com.bitnpulse.dev2.jjh.engstudybook_free.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.net.Uri;

public class WritingDB extends SQLiteOpenHelper {
	
	
	private static final String DATABASE_NAME = "Writing.db";//must modify db name 
	private static final int DATABASE_VERSION = 1;
	
	public  static final String TABLE_NAME = "Writing_DB";
	
	public static final String _ID = "_id";
	public static final String CONTENT_ID				= "content_id";
	public static final String DIARY_1 				= "diary_1";
	public static final String DIARY_2 				= "diary_2";
	public static final String COMPOSITION 			= "composition";
	
	public static final String[] FROM 	= {_ID , CONTENT_ID , DIARY_1 , DIARY_2 , COMPOSITION };
	public  String ORDER_BY = _ID+" DESC"; 
	
	 
	public WritingDB(Context context) {
	        super(context, DATABASE_NAME, null, DATABASE_VERSION);
	    }
	 
	 @Override
	    public void onCreate(SQLiteDatabase db) {
			db.execSQL("CREATE TABLE " 	+ TABLE_NAME 			
					+ " (" 
			
					+ _ID  							+ " INTEGER PRIMARY KEY AUTOINCREMENT," 
					+ CONTENT_ID				  	+ " TEXT," 
					+ DIARY_1				  			+ " TEXT," 
					+ DIARY_2							+ " TEXT,"
					+ COMPOSITION						+ " TEXT"
					+ ");");
	    }
	 
	 @Override
	    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
	        db.execSQL("DROP TABLE IF EXISTS ListT");
	        onCreate(db);
	    }
}